def print_file_info(file_name):
    f = None
    try:
        f = open(file_name, 'r',encoding='utf-8')
        ret = f.read()
        print(ret)
    except Exception as e:
        print(e)
    finally:
        if f:
            f.close()
        # try:
        #     f.close()
        # except Exception as e2:
        #     print(e2)



def append_to_file(file_name, data):
    with open(file_name, 'a') as f:
        f.write(data)

if __name__ == '__main__':
    print_file_info('../test/bill.txt')
    append_to_file('../test/abc.txt','olleh dlrow!')